// 通用业务组件类型定义

// 数据表格列定义
export interface TableColumn<T> {
  key: string;
  title: string;
  dataIndex: keyof T;
  width?: number;
  searchable?: boolean;
  sortable?: boolean;
  render?: (value: any, record: T) => React.ReactNode;
}

// 表单字段定义
export interface FormField<T> {
  name: keyof T;
  label: string;
  type: 'text' | 'number' | 'select' | 'checkbox' | 'radio' | 'textarea' | 'date' | 'password';
  required?: boolean;
  placeholder?: string;
  options?: { label: string; value: any }[];
  validator?: (value: any) => string | null;
}

// 统计卡片数据定义
export interface StatisticCardData {
  title: string;
  value: string | number;
  description?: string;
  trend?: 'up' | 'down' | 'neutral';
  percentage?: number;
  icon?: React.ReactNode;
}

// 热点数据项定义
export interface HotItem {
  id: number;
  title: string;
  url: string;
  source: string;
  hot_score: number;
  publish_time: string;
  tags?: string[];
  summary?: string;
}

// 通知消息定义
export interface NotificationMessage {
  id: number;
  title: string;
  content: string;
  type: 'info' | 'success' | 'warning' | 'error';
  timestamp: string;
  read: boolean;
}

// 用户信息定义
export interface UserInfo {
  id: number;
  username: string;
  email: string;
  avatar?: string;
  role: string;
  last_login?: string;
  created_at: string;
}

// 分页数据定义
export interface PaginationData<T> {
  items: T[];
  total: number;
  page: number;
  pageSize: number;
  totalPages: number;
}

// 搜索参数定义
export interface SearchParams {
  keyword?: string;
  page?: number;
  pageSize?: number;
  sortBy?: string;
  sortOrder?: 'asc' | 'desc';
  filters?: Record<string, any>;
}

// API响应定义
export interface ApiResponse<T> {
  success: boolean;
  data?: T;
  message?: string;
  error?: string;
  pagination?: {
    total: number;
    page: number;
    pageSize: number;
    totalPages: number;
  };
}